﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WpfCourse.Common;
using WpfCourse.Model;

namespace WpfCourse.ViewModel
{
    public class ProjectPageViewModel
    {
        public ObservableCollection<CategoryItemModel> CourseTypes { get; set; }
        public ObservableCollection<CategoryItemModel> Technologies { get; set; }
        public ObservableCollection<CategoryItemModel> Teachers { get; set; }
        public ObservableCollection<CourseModel> CourseList { get; set; }
        public CommandBase OpenCourseUrl { get; set; }

        public ProjectPageViewModel()
        {
            this.CourseTypes = new ObservableCollection<CategoryItemModel>();
            this.CourseTypes.Add(new CategoryItemModel("全部", true));
            this.CourseTypes.Add(new CategoryItemModel("公开课"));
            this.CourseTypes.Add(new CategoryItemModel("VIP课程"));

            this.Technologies = new ObservableCollection<CategoryItemModel>();
            this.Technologies.Add(new CategoryItemModel("全部", true));
            this.Technologies.Add(new CategoryItemModel("C#"));
            this.Technologies.Add(new CategoryItemModel("JAVA并发编程"));
            this.Technologies.Add(new CategoryItemModel("微服务实战"));
            this.Technologies.Add(new CategoryItemModel("React.js实战"));

            this.Teachers = new ObservableCollection<CategoryItemModel>();
            this.Teachers.Add(new CategoryItemModel("全部", true));
            this.Teachers.Add(new CategoryItemModel("王老师"));
            this.Teachers.Add(new CategoryItemModel("李老师"));
            this.Teachers.Add(new CategoryItemModel("张三"));
            this.Teachers.Add(new CategoryItemModel("李四"));


            this.CourseList = new ObservableCollection<CourseModel>();
            this.CourseList.Add(new CourseModel()
                {
                    CourseName = "Java并发编程实战",
                    Cover = "../../Assets/Images/pig.png",
                    Url = "https://www.baidu.com",
                    Description = "并发编程实战并发编程实战并发编程实战并发编程实战并发编程实战并发编程实战并发编程实战并发编程实战并发编程实战并发编程实战并发编程实战并发编程实战",
                    Teachers = new List<string>() { "张三", "李四", "王麻子" }
                });
            this.CourseList.Add(new CourseModel()
            {
                CourseName = "Java并发编程实战",
                Cover = "../../Assets/Images/pig.png",
                Url = "https://www.baidu.com",
                Description = "并发编程实战并发编程实战并发编程实战并发编程实战并发编程实战并发编程实战并发编程实战并发编程实战并发编程实战并发编程实战并发编程实战并发编程实战并发编程实战并发编程实战并发编程实战并发编程实战并发编程实战并发编程实战并发编程实战并发编程实战并发编程实战并发编程实战并发编程实战并发编程实战",
                Teachers = new List<string>() { "张三", "李四", "王麻子" }
            });
            this.CourseList.Add(new CourseModel()
            {
                CourseName = "Java并发编程实战",
                Cover = "../../Assets/Images/pig.png",
                Url = "https://www.baidu.com",
                Description = "并发编程实战并发编程实战并发编程实战并发编程实战并发编程实战并发编程实战并发编程实战并发编程实战并发编程实战并发编程实战并发编程实战并发编程实战",
                Teachers = new List<string>() { "张三", "李四", "王麻子" }
            });
            this.CourseList.Add(new CourseModel()
            {
                CourseName = "Java并发编程实战",
                Cover = "../../Assets/Images/pig.png",
                Url = "https://www.baidu.com",
                Description = "并发编程实战并发编程实战并发编程实战并发编程实战并发编程实战并发编程实战并发编程实战并发编程实战并发编程实战并发编程实战并发编程实战并发编程实战",
                Teachers = new List<string>() { "张三", "李四", "王麻子" }
            });


            this.OpenCourseUrl = new CommandBase();
            this.OpenCourseUrl.DoCanExecute = new Func<object, bool>(o => true);
            this.OpenCourseUrl.DoExecute = new Action<object>(o =>
            {
                System.Diagnostics.Process.Start(o.ToString());
            });
        }
    }
}
